{extend name="web/public/base" /}
{block name="header"}
<link rel="stylesheet" href="__WAP__/webuploader/webuploader.css"/>
<style>
    .webuploader-pick {
        margin-left: 0 !important;
        top: 0 !important;
    }

    .webuploader-pick-hover {
        background: rgba(255, 255, 255, 0) !important;
    }
</style>
<script type="text/javascript" src="__WAP__/webuploader/webuploader.html5only.js"></script>
<script type="text/javascript" src="__WAP__/webuploader/webuploader.html5only.min.js"></script>
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">购物商城</li>
        <li class="active">{$title}</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading"> {$title}</header>
                <!--<div style="margin-top: 10px;margin-left:15px;margin-bottom: 10px;">-->
                <!--<button type="button" class="btn btn-primary" onclick="allAuditing();">一键发货</button>-->
                <!--</div>-->
                {include file="web/public/search" /}

                <div class="form-group col-sm-6">
                    <label></label>
                    <div id="picker1">
                        <button>导入文件</button>
                        （列名：订单号，寄件人，寄件人电话，发货地址，快递公司，快递单号）
                        <input type="hidden" name="goods_ico" id="goods_ico" value=""/>
                    </div>

                    <script type="text/javascript">
                        var uploader1 = WebUploader.create({
                            // 文件接收服务端。
                            server: "{:url('Order/orderImport')}",
                            // 选择文件的按钮。可选。
                            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                            pick: '#picker1',
                            // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
                            resize: false,
                            accept: {
//                                extensions: 'gif,jpg,jpeg,png',
//                                mimeTypes: 'img/*'
                            }
                        });

                        // 当有文件被添加进队列的时候
                        uploader1.on('fileQueued', function (file) {
                            // layer.msg('图片' + file.id + ":" + file.name + "已被选中");
                            uploader1.upload();
                        });
                        // 文件上传过程中创建进度条实时显示。
                        uploader1.on('uploadProgress', function (file, percentage) {
                            var $li = $('#' + file.id),
                                $percent = $li.find('.progress .progress-bar');

                            // 避免重复创建
                            if (!$percent.length) {
                                $percent = $('<div class="progress progress-striped active">' +
                                    '<div class="progress-bar" role="progressbar" style="width: 0%">' +
                                    '</div>' +
                                    '</div>').appendTo($li).find('.progress-bar');
                            }

                            $li.find('p.state').text('上传中');

                            $percent.css('width', percentage * 100 + '%');
                        });

                        uploader1.on('uploadSuccess', function (file, res) {
                            layer.msg(res.msg);
                            setTimeout(function () {
                                location.reload();
                            }, 1000)
                        });

                        uploader1.on('uploadError', function (file) {
                            alert("上传失败");
                        });
                    </script>
                </div>
                {notempty name="_list"}
                <div class="table-responsive">
                    <table class="table table-striped table-hover b-t b-light text-sm">
                        <thead>
                        <tr style="cursor:pointer;">
                            <th>下单时间</th>
                            <th>会员账号</th>
                            <th>订单编号</th>
                            <th>商品名称</th>
                            <th>商品总额</th>
                            {neq name="$action" value="index"}<th>快递单号</th>{/neq}
                            <!--<th>商品分类</th>-->
                            <th>状态</th>
                            <!--<th>配送方式</th>-->
                            <th>{$Think.const.OP}</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name='_list' id='vo'}
                        <tr>
                            <td>{$vo.pay_time|date="Y-m-d H:i:s",###}</td>
                            <td>{$vo.uid|getInfo="usernumber",###}[{$vo.uid|getInfo="realname",###}]</td>
                            <td>{$vo.orderid}</td>
                            <td>{$vo.goods_info}</td>
                            <td>{$vo.total}</td>
                            {neq name="$action" value="index"}<td>{$vo.toolid}</td>{/neq}
                            <!--<td>{$vo.cate_name}</td>-->
                            <td>
                                {eq name="vo.status" value="1"}待发货{/eq}
                                {eq name="vo.status" value="10"}待确认{/eq}
                                {eq name="vo.status" value="20"}已完成{/eq}
                                <!--{eq name="vo.status" value="5"}<span style="color:red;">有申诉</span>{/eq}-->
                                <!--{eq name="vo.status" value="6"}退货退款{/eq}-->
                            </td>
                            <!--<td>-->
                            <!--{eq name="vo.shipway" value="1"}快递{/eq}-->
                            <!--{eq name="vo.shipway" value="2"}自提{/eq}-->
                            <!--</td>-->
                            <td>
                                <!--{eq name="vo.status" value="1"}-->
                                <!--<button onclick="fahuo({$vo.id});return false;">发货</button>-->
                                <!--{/eq}-->
                                <a class="btn btn-link"
                                   href="{:url('details',array('id'=>$vo['id'],'action'=>$action))}">查看详情</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <footer class="panel-footer">
                    <div class="row">
                        <div class="text-right text-center-xs">
                            {$page}
                        </div>
                    </div>
                </footer>
                {else/}
                <div style="text-align: center">
                    <image src="__PUBLIC__/images/empty.jpg"></image>
                </div>
                {/notempty}
            </section>
        </div>
    </div>
</section>
{/block}
{block name="script"}
<script type="text/javascript">
    //    $('.toolid').each(function () {
    //        $(this).change(function () {
    //            var toolid = $(this).val();
    //            var id = $(this).parent().find('input[name=id]').val();
    //            $.post("{:url('changeToolid')}", {toolid: toolid, id: id}, function (data) {
    //                layer.msg(data.msg);
    //                if (data.code) {
    //                    setTimeout(function () {
    //                        location.reload();
    //                    }, 1000)
    //                }
    //            }, 'json');
    //        })
    //    })

//    $('#daoru').click(function () {
//        $.post("{:url('orderImport')}", {}, function (data) {
//            layer.msg(data.msg);
////            if (data.code) {
//////                setTimeout(function () {
//////                    location.reload();
//////                }, 1000)
////            }
//        }, 'json');
//    })

    /**
     * 发货
     * @param id
     */
    function fahuo(id) {
        $.post("{:url('send')}", {id: id}, function (data) {
            layer.msg(data.msg);
            if (data.code) {
                setTimeout(function () {
                    location.reload();
                }, 1000)
            }
        }, 'json')
    }

</script>
{/block}
{block name="footer"}
{/block}